import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import { viteMockServe } from 'vite-plugin-mock'

// https://vitejs.dev/config/
export default defineConfig(({ command })=>{
  return {
    plugins: [vue(),
    createSvgIconsPlugin({
      iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
      symbolId: 'icon-[dir]-[name]',
    }), viteMockServe({
      mockPath: 'mock',
      enable: true,
    })],
    base: './',
    resolve: {
      alias: {
        '@': '/src'
      },
      extensions: ['.js', '.ts', '.vue', '.json', '.css']
    },
    css: {  
      preprocessorOptions: {  
        scss: {  
          javascriptEnabled: true,  
          additionalData: '@import "./src/styles/variable.scss";',  
        },  
      },  
    }
  }
})